#! encoding: utf-8
import requests

from xml.dom.minidom import parse
import xml.dom.minidom


d = '''
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bus="http://www.huawei.com/bme/aaainterface/cbs/businessmgrmsg" xmlns:com="http://www.huawei.com/bme/aaainterface/common" xmlns:bus1="http://www.huawei.com/bme/aaainterface/cbs/businessmgr">  
  <soapenv:Header/>  
  <soapenv:Body> 
    <bus:DeleteAAASubscriberRequestMsg> 
      <RequestHeader> 
        <com:CommandId>DeleteAAASubscriber</com:CommandId>  
        <com:Version>1</com:Version>  
        <com:TransactionId/>  
        <com:SequenceId>1</com:SequenceId>  
        <com:RequestType>Event</com:RequestType>  
        <com:SessionEntity> 
          <com:Name/>  
          <com:Password/>  
          <com:RemoteAddress/> 
        </com:SessionEntity>  
        <com:InterFrom></com:InterFrom>  
        <com:InterMode></com:InterMode>  
        <com:InterMedi></com:InterMedi>  
        <com:visitArea></com:visitArea>  
        <com:currentCell></com:currentCell>  
        <com:additionInfo></com:additionInfo>  
        <com:ThirdPartyID>12</com:ThirdPartyID>  
        <com:Reserve2></com:Reserve2>  
        <com:Reserve3></com:Reserve3>  
        <com:PartnerID></com:PartnerID>  
        <com:OperatorID></com:OperatorID>  
        <com:TradePartnerID></com:TradePartnerID>  
        <com:PartnerOperID></com:PartnerOperID>  
        <com:BelToAreaID></com:BelToAreaID>  
        <com:SerialNo></com:SerialNo>  
        <com:Remark></com:Remark>  
        <com:Locale>EN</com:Locale> 
      </RequestHeader>  
      <DeleteAAASubscriberRequest> 
        <bus1:SubscriberID>{account}</bus1:SubscriberID>  
        <bus1:SubscriberIDType>3</bus1:SubscriberIDType>  
        <bus1:OperatorInfo> 
          <bus1:OperID/>  
          <bus1:DeptID/> 
        </bus1:OperatorInfo> 
      </DeleteAAASubscriberRequest> 
    </bus:DeleteAAASubscriberRequestMsg> 
  </soapenv:Body> 
</soapenv:Envelope>

'''

class AAA(object):
    def __init__(self):
        pass

    def delete_account(self,account ):
        r = requests.post('http://116.6.110.158:7782/services/AAAInterfaceBusinessMgrService.AAAInterfaceBusinessMgrServiceSOAP11port_http/', data=d.format(account=account))
        print(r.text)


        DOMTree = xml.dom.minidom.parseString(r.text)

        collection = DOMTree.documentElement

        ResultCode = collection.getElementsByTagName("ResultCode")[0].childNodes[0].data
        ResultDesc = collection.getElementsByTagName("ResultDesc")[0].childNodes[0].data

        return (ResultCode,ResultDesc)

if __name__ == '__main__':
    a = AAA()
    result = a.delete_account('21fh800001@laotel.com')
    print( result)